<template>
    <div class="login-container ub cross-center main-center ">
        <div class="snow-all">
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
                    <div class="snow"></div>
        </div>
        <el-form :model="loginForm" ref="loginRef" label-width="80px" class="login-form login-blur" :rules="loginRules">
            <el-form-item label>
                <div class="login-title ub main-center cross-center">
                    人脸识别点名后台管理系统
                </div>
            </el-form-item>
            <el-form-item label prop="username">
                <el-input v-model="loginForm.username" placeholder="输入用户名"></el-input>
            </el-form-item>
            <el-form-item label prop="password">
                <el-input v-model="loginForm.password" placeholder="输入密码" type="password"></el-input>
            </el-form-item>
            <el-form-item prop="code">
                <el-row :gutter="10">
                    <el-col :span="16" >
                        <el-input placeholder="请输入验证码" v-model="loginForm.code"></el-input>
                    </el-col>
                    <el-col :span="8">
                        <img @click="getImage" :src="imgSrc" class="codeImg"/>
                    </el-col>
                </el-row>
            </el-form-item>
            <el-form-item>
                <el-row :gutter="20">
                    <el-col :span="12">
                        <el-button type="primary" class="login-button" @click="submit()">登陆</el-button>
                    </el-col>
                    <el-col :span="12">
                        <el-button type="info" class="login-button">注册</el-button>
                    </el-col>
                </el-row>
            </el-form-item>
        </el-form>
    </div>    
</template>
<script>
export default {
    data () {
        return {
            // 登陆表单
            loginForm: {
                username: '',
                password: '',
                code: ''
            },
            // 验证
            loginRules: {
                username: [
                    { required: true, message: '请输入用户名', trigger: 'change' },                
                ],
                password: [
                    { required: true, message: '请输入密码', trigger: 'change' },                
                ],
                code: [
                    { required: true, message: '请输入验证码', trigger: 'change' },                
                ]
            },
            // 验证码图片地址
            imgSrc: ''
        }
    },
    created() {
        this.getImage();
    },
    methods: {
        async submit() {
            this.$router.push({ path: '/home' })
            // let formData = new FormData();
            // formData.append("username", this.loginForm.username);
            // formData.append("password", this.loginForm.password);
            // formData.append("code", this.loginForm.code);
            // let { data: res } = await this.$http.post( // eslint-disable-line no-unused-vars
            //     "/api/user/login",
            //     formData
            // );
            // if(res.code!= 200){
            //     this.$message.error(res.msg)
            //     return;
            // }
            // let menuList = res.data.menuList;
            // let routerList = res.data.routerList;
            // let auths = res.data.authList;
            //  let data = await this.$http.post ("api/user/login",this.loginForm)
            // console.log(res);
             
            
        },
        //获取验证码 
        getImage(){ 
            // let res = "http://localhost:8089/api/user/image?t=" + new Date().getTime(); 
            // this.imgSrc = res; 
        }
    }
}
</script>
<style scoped>
.login-container {
    height: 100%;
    background-image: url('../../assets/image/loginbg.jpg');

}
/* 毛玻璃效果 */
.login-blur::before{
    content: "";
    position: absolute;
    top:0;
    right: 0;
    bottom: 0;
    left: 0;
    filter: blur(20px);
    -webkit-filter: blur(20px);
    -moz-filter: blur(20px);
    -ms-filter: blur(20px);
    -o-filter: blur(20px);
    margin: -30px;

}
.login-title {
    font-size: 24px;
    font-weight: 600;
}
.login-form {
    /* 毛玻璃效果 */ 
    position: relative;
    background: hsla(0,0%,100%,.3);
    overflow: hidden;

    height: 300px;
    width: 350px;
    border-radius: 10px;
    box-shadow: 0 0 25px #cac6c6;
    padding: 20px 35px;
    /* background-color: rgba(255,255,255,0.8); */

}
.login-container /deep/ .el-form-item__content{
    margin-left: 0 !important;
}
.login-button {
    width:100%;
}
.codeImg { 
    width: 100%; 
    cursor: pointer; 
}
</style>